<template>
  <div class="home container">
    <el-card shadow="hover" style="margin: 0">
      <!--   下面引入echarts图表   -->
      <div style="height: 450px">
        <div
          id="exc1"
          style="
            width: 49%;
            height: 430px;
            float: left;
            box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
          "
        ></div>
        <div
          id="exc2"
          style="
            width: 49%;
            height: 430px;
            float: right;
            box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
          "
        ></div>
      </div>
    </el-card>
  </div>
</template>

<script setup lang="ts">
//import { useUserStore } from '@/store/modules/user'
//import { timeFix, welcome } from '@/utils/index'
//import SvgIcon from '@/components/SvgIcon/src/SvgIcon.vue'
//import { getEnvByName } from '@/utils/getEnv'
//import logoPng from '@/assets/images/logo.png'
import { onMounted } from 'vue'
// 引入 echarts
import * as echarts from 'echarts'
// const userStore = useUserStore()
// const userInfo = userStore.userInfo
// echarts 折线图
const LineChart = () => {
  const dom = document.getElementById('exc1')
  const myChart = echarts.init(dom) // 初始化echarts实例
  const option = {
    title: {
      text: '最近15天新增用户数',
    },
    tooltip: {
      trigger: 'axis',
    },
    xAxis: {
      name: '日期',
      type: 'category',
      data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    },
    yAxis: {
      type: 'value',
    },
    series: [
      {
        data: [820, 932, 901, 934, 1290, 1330, 1320],
        type: 'line',
        smooth: true,
      },
    ],
  }
  // 设置实例参数
  myChart.setOption(option)
}
// echarts 柱状图
const ColumnarChart = () => {
  const dom = document.getElementById('exc2')
  const myChart = echarts.init(dom) // 初始化echarts实例
  const option = {
    title: {
      text: '最近15天签约数',
    },
    tooltip: {
      trigger: 'axis',
    },
    xAxis: {
      name: '日期',
      type: 'category',
      data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    },
    yAxis: {
      type: 'value',
    },
    series: [
      {
        data: [820, 932, 901, 934, 1290, 1330, 1320],
        type: 'bar',
        smooth: true,
      },
    ],
  }
  // 设置实例参数
  myChart.setOption(option)
}
onMounted(() => {
  // 初始化echarts
  LineChart()
  ColumnarChart()
})
</script>

<style scoped lang="scss">
.home {
  height: 100%;

  .page-header {
    display: flex;
    align-items: center;

    .page-header-tip {
      flex: 1;
      margin-left: 20px;
    }

    .page-header-tip-title {
      margin-bottom: 12px;
      font-size: 20px;
      font-weight: 700;
      color: #3c4a54;
    }

    .page-header-tip-desc {
      min-height: 20px;
      font-size: 14px;
      color: #808695;
    }
  }

  .welcome {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
  }
}
</style>
